//
//  KKImageBrowser.m
//  ReplyAssistant
//
//  Created by liaozhenming on 2018/11/29.
//  Copyright © 2018 KK. All rights reserved.
//

#import "KKImageBrowser.h"

#import "KKImageBrowserViewController.h"

@implementation KKImageBrowser

//  通过路径图片展示
+ (void)kk_showImagesWithPaths:(NSArray*)imagePaths {
    
    NSMutableArray *items = [NSMutableArray array];
    for (NSString *path in imagePaths) {
        KKImageBrowserItem *item = [KKImageBrowserItem new];
        item.itemPath = path;
        [items addObject: item];
    }
    [self private_showBrowserControllerWithItems: items];
}

//  通过image展示
+ (void)kk_showImagesWithImages:(NSArray*)images {
    NSMutableArray *items = [NSMutableArray array];
    for (UIImage* image in images) {
        KKImageBrowserItem *item = [KKImageBrowserItem new];
        item.itemImage = image;
        [items addObject: item];
    }
    [self private_showBrowserControllerWithItems: items];
}


+ (void)private_showBrowserControllerWithItems:(NSArray*)items {
    
    UIViewController *rootViewController = [[[UIApplication sharedApplication] delegate] window].rootViewController;
    KKImageBrowserViewController *browserViewController = [KKImageBrowserViewController new];
    browserViewController.arr_items = items;
    UINavigationController *navigationController = [[UINavigationController alloc] initWithRootViewController: browserViewController];
    
    browserViewController.navigationController.navigationBarHidden = true;
    [rootViewController presentViewController: navigationController animated: true completion: nil];
}
@end


@implementation KKImageBrowserItem


@end
